package com.yangjun.controller.departmentCustomizationAnalysis;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.yangjun.entity.departmentCustomizationAnalysis.PreSalesSectionOverViewEntity;
import com.yangjun.service.departmentCustomization.PreSalesKeyProductService;
import com.yangjun.service.departmentCustomization.PreSalesPharmacistService;
import com.yangjun.service.departmentCustomization.PreSalesRecommendProductService;
import com.yangjun.service.departmentCustomization.PreSalesSectionService;
import com.yangjun.service.departmentCustomization.PreSalesSingleProductService;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@RestController
@RequestMapping(value="/api/dca/presales/section/",method=RequestMethod.GET)
public class PreSalesSectionController {
	
	@Autowired
	private PreSalesSectionService preSalesSectionService;
	@Autowired
	private PreSalesPharmacistService preSalesPharmacistService;
	@Autowired
	private PreSalesKeyProductService preSalesKeyProductService;
	@Autowired
	private PreSalesSingleProductService preSalesSingleProductService;
	@Autowired
	private PreSalesRecommendProductService preSalesRecommendProductService;
	/**
	 * @Description获取下拉列表
	 * @return
	 * @author yangjun
	 * @Date 2017年3月6日 下午1:44:25
	 */
	@ApiOperation(value="获取下拉列表",notes="各种科组页面所需要的维表信息")
	@ResponseBody
	@RequestMapping(value="querySectionDropDownList")
	public Map<String,List<String>> querySectionDropDownList(){
		return preSalesSectionService.querySectionDropDownList();
	}
	
	/**
	 * @Description 根据科室名获取月概览
	 * @param groupName
	 * @return
	 * @author yangjun
	 * @Date 2017年3月6日 下午1:44:44
	 */
	@ApiOperation(value="查找科室月概览",notes="根据科组名筛选")
	@ResponseBody
	@RequestMapping(value="queryMonthSummary")
	public PreSalesSectionOverViewEntity queryMonthSummary(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="beginDate", value ="开始时间") @RequestParam(value = "beginDate",required = false)String beginDate,
			@ApiParam(required = true, name ="endDate", value ="结束时间") @RequestParam(value = "endDate",required = false)String endDate){
		return preSalesSectionService.queryMonthSummary(groupName,beginDate,endDate);
	}
	
	/**
	 * @Description 查找科室渠道销售表格
	 * @param groupName
	 * @return
	 * @author yangjun
	 * @Date 2017年3月6日 下午1:44:44
	 */
	@ApiOperation(value="查找科室渠道销售表格",notes="根据科组名工具名科室名筛选")
	@ResponseBody
	@RequestMapping(value="queryChannelSalesTable")
	public List<PreSalesSectionOverViewEntity> queryChannelSalesTable(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="channelName", value ="工具名(如:在线咨询)") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="column", value ="排序列名") @RequestParam(value = "column",required = false)String column,
			@ApiParam(required = true, name ="sort", value ="排序方式") @RequestParam(value = "sort",required = false)String sort,
			@ApiParam(required = true, name ="beginDate", value ="开始时间") @RequestParam(value = "beginDate",required = false)String beginDate,
			@ApiParam(required = true, name ="endDate", value ="结束时间") @RequestParam(value = "endDate",required = false)String endDate){
		return preSalesSectionService.queryChannelSalesTable(groupName,channelName,roomName,column,sort,beginDate,endDate);
	}
	/**
	 * @Description 查找科室平台销售表格
	 * @param groupName
	 * @return
	 * @author yangjun
	 * @Date 2017年3月6日 下午1:44:44
	 */
	@ApiOperation(value="查找科室平台销售表格",notes="根据科组名工具名科室名筛选")
	@ResponseBody
	@RequestMapping(value="queryPlatformSalesTable")
	public List<PreSalesSectionOverViewEntity> queryPlatformSalesTable(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="channelName", value ="工具名(如:在线咨询)") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="column", value ="排序列名") @RequestParam(value = "column",required = false)String column,
			@ApiParam(required = true, name ="sort", value ="排序方式") @RequestParam(value = "sort",required = false)String sort,
			@ApiParam(required = true, name ="beginDate", value ="开始时间") @RequestParam(value = "beginDate",required = false)String beginDate,
			@ApiParam(required = true, name ="endDate", value ="结束时间") @RequestParam(value = "endDate",required = false)String endDate){
		return preSalesSectionService.queryPlatformSalesTable(groupName,channelName,roomName,column,sort,beginDate,endDate);
	}
	/**
	 * 
	 * @Description 每天每小时折线图对比
	 * @param contrastDate
	 * @param groupName
	 * @param channelName
	 * @param roomName
	 * @author yangjun
	 * @Date 2017年3月8日 下午5:04:26
	 */
	@ApiOperation(value="每天每小时折线图对比",notes="根据科组名，渠道名，科室名，对比日来筛选")
	@ResponseBody
	@RequestMapping(value="queryComparisonLineChartByHourofDay")
	public Map<String,Object> queryComparisonLineChartByHourofDay(
			@ApiParam(required = true, name ="contrastDate", value ="对比日期(xxxx-xx-xx)") @RequestParam(value = "contrastDate",required = false)String contrastDate,
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="channelName", value ="工具名(如:在线咨询)") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName){
		return preSalesSectionService.querySectionComparisonLineChartByHourofDay(contrastDate,groupName,channelName,roomName);
	}
	
	/**
	 * @Description 当天对比上周折线图对比
	 * @param groupName
	 * @param channelName
	 * @param roomName
	 * @return
	 * @author yangjun
	 * @Date 2017年3月8日 下午5:05:13
	 */
	@ApiOperation(value="当天对比上周折线图对比",notes="根据科组名，渠道名，科室名来筛选")
	@ResponseBody
	@RequestMapping(value="queryComparisonLineChartByDayofWeek")
	public Map<String,Object> queryComparisonLineChartByDayofWeek(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="channelName", value ="工具名(如:在线咨询)") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName){
		return preSalesSectionService.querySectionComparisonLineChartByDayofWeek(groupName,channelName,roomName);
	}
	/**
	 * 
	 * @Description 当月对比上月折线图对比
	 * @param groupName
	 * @param channelName
	 * @param roomName
	 * @return
	 * @author yangjun
	 * @Date 2017年3月8日 下午5:05:13
	 */
	@ApiOperation(value="当月对比上月折线图对比",notes="根据科组名，渠道名，科室名来筛选")
	@ResponseBody
	@RequestMapping(value="queryComparisonLineChartByDayofMonth")
	public Map<String,Object> queryComparisonLineChartByDayofMonth(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="channelName", value ="工具名(如:在线咨询)") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName){
		return preSalesSectionService.querySectionComparisonLineChartByDayofMonth(groupName,channelName,roomName);
	}
	
	/**
	 * 
	 * @Description 这周对比上周折线图对比
	 * @param groupName
	 * @param channelName
	 * @param roomName
	 * @return
	 * @author yangjun
	 * @Date 2017年3月8日 下午5:05:13
	 */
	@ApiOperation(value="这周对比上周折线图对比",notes="根据科组名，渠道名，科室名来筛选")
	@ResponseBody
	@RequestMapping(value="queryComparisonLineChartByWeek")
	public Map<String,Object> queryComparisonLineChartByWeek(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="channelName", value ="工具名(如:在线咨询)") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName){
		return preSalesSectionService.querySectionComparisonLineChartByWeek(groupName,channelName,roomName);
	}
	
	
	/**
	 * 
	 * @Description 查询表格数据（近30天）
	 * @param contrastDate
	 * @param groupName
	 * @param channelName
	 * @param roomName
	 * @author yangjun
	 * @Date 2017年3月8日 下午5:04:26
	 */
	@ApiOperation(value="查询表格数据（近30天）",notes="根据科组名，渠道名，科室名来筛选")
	@ResponseBody
	@RequestMapping(value="queryTableDataByDay")
	public Map<String,List<String[]>> querySectionTableDataByDay(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="channelName", value ="工具名(如:在线咨询)") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName){
		return preSalesSectionService.querySectionTableDataByDay(groupName,channelName,roomName);
	}
	
	/**
	 * 
	 * @Description 查询表格数据（近12个月）
	 * @param contrastDate
	 * @param groupName
	 * @param channelName
	 * @param roomName
	 * @author yangjun
	 * @Date 2017年3月8日 下午5:04:26
	 */
	@ApiOperation(value="查询表格数据（近12个月）",notes="根据科组名，渠道名，科室名来筛选")
	@ResponseBody
	@RequestMapping(value="queryTableDataByMonth")
	public Map<String,List<String[]>> querySectionTableDataByMonth(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="channelName", value ="工具名(如:在线咨询)") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName){
		return preSalesSectionService.querySectionTableDataByMonth(groupName,channelName,roomName);
	}

	/**
	 * 
	 * @Description 查询表格数据（近1年）
	 * @param contrastDate
	 * @param groupName
	 * @param channelName
	 * @param roomName
	 * @author yangjun
	 * @Date 2017年3月8日 下午5:04:26
	 */
	@ApiOperation(value="科组页面查询表格数据（近1年）",notes="根据科组名，渠道名，科室名来筛选")
	@ResponseBody
	@RequestMapping(value="queryTableDataByYear")
	public Map<String,List<String[]>> querySectionTableDataByYear(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="channelName", value ="工具名(如:在线咨询)") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName){
		return preSalesSectionService.querySectionTableDataByYear(groupName,channelName,roomName);
	}
	
	/**
	 * @Description 药师页面根据科组名查询药师任务完成率排名客单价排名
	 * @param groupName 科组名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月13日 下午2:39:26
	 */
	@ApiOperation(value="药师页面根据科组名查询药师任务完成率排名客单价排名",notes="根据科组名来筛选")
	@ResponseBody
	@RequestMapping(value="pharmacist/queryCompletionRateByStaff")
	public Map<String,List<Map<String,Object>>> queryPharmacistCompletionRateByStaff(@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName){
//		groupName="常青组";
		return preSalesPharmacistService.queryCompletionRateByStaff(groupName);
	}
	
	/**
	 * @Description 药师页面员工销售表格
	 * @param groupName 科组名
	 * @param sourceName 平台名
	 * @param roomName 科室名
	 * @param staffName 员工名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月13日 下午2:39:26
	 */
	@ApiOperation(value="药师页面员工销售表格",notes="根据科组名，平台名，科室名，员工名来筛选")
	@ResponseBody
	@RequestMapping(value="pharmacist/queryStaffSalesTable")
	public List<Object[]> queryPharmacistStaffSalesTable(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台(如:PC网店)") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName){
//		groupName="常青组";
//		sourceName="PC网站";
//		roomName="家庭药箱";
//		staffName="欧文莉";
		return preSalesPharmacistService.queryStaffSalesTable(groupName,sourceName,roomName,staffName);
	}
	/**
	 * @Description 药师页面某员工的渠道销售表格
	 * @param groupName
	 * @param sourceName
	 * @param roomName
	 * @param staffName
	 * @return
	 * @author yangjun
	 * @Date 2017年3月15日 上午10:33:48
	 */
	@ApiOperation(value="药师页面某员工的渠道销售表格",notes="根据科组名，平台名，科室名，员工名来筛选")
	@ResponseBody
	@RequestMapping(value="queryStaffSalesTableByChannel")
	public List<Object[]> queryStaffSalesTableByChannel(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台(如:PC网店)") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName){
//		groupName="常青组";
//		sourceName="PC网站";
//		roomName="家庭药箱";
//		staffName="陈景敏";
		return preSalesPharmacistService.queryStaffSalesTableByChannel(groupName,sourceName,roomName,staffName);
	}
	/**
	 * @Description 药师页面昨天今天时对比折线图
	 * @param groupName 科组名
	 * @param sourceName 平台名
	 * @param roomName 科室名
	 * @param staffName 员工名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月15日 上午10:30:36
	 */
	@ApiOperation(value="药师页面昨天今天时对比折线图",notes="根据科组名，平台名，科室名，员工名来筛选")
	@ResponseBody
	@RequestMapping(value="pharmacist/queryComparisonLineChartByHourofDay")
	public Map<String,Object>  queryPharmacistComparisonLineChartByHour(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台名") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName){
//		groupName="常青组";
//		sourceName="PC网站";
//		roomName="消化系统";
//		staffName="罗健薇";
		return preSalesPharmacistService.queryPharmacistComparisonLineChartByHour(groupName, sourceName, roomName,staffName);
	}
	/**
	 * @Description 药师页面上周本周某天对比折线图
	 * @param groupName 科组名
	 * @param sourceName 平台名
	 * @param roomName 科室名
	 * @param staffName 员工名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月15日 上午10:30:00
	 */
	@ApiOperation(value="药师页面上周本周某天对比折线图",notes="根据科组名，平台名，科室名，员工名来筛选")
	@ResponseBody
	@RequestMapping(value="pharmacist/queryComparisonLineChartByDayofWeek")
	public Map<String,Object> queryPharmacistComparisonLineChartByDayofWeek(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台名") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName){
//		groupName="常青组";
//		sourceName="PC网站";
//		roomName="消化系统";
//		staffName="罗健薇";
		return preSalesPharmacistService.queryPharmacistComparisonLineChartByDayofWeek(groupName,sourceName,roomName,staffName);
	}
	/**
	 * @Description 药师页面上月本月月对比折线图
	 * @param groupName 科组名
	 * @param sourceName 平台名
	 * @param roomName 科室名
	 * @param staffName 员工名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月15日 上午10:29:13
	 */
	@ApiOperation(value="药师页面上月本月月对比折线图",notes="根据科组名，平台名，科室名，员工名来筛选")
	@ResponseBody
	@RequestMapping(value="pharmacist/queryComparisonLineChartByDayofMonth")
	public Map<String,Object> queryPharmacistComparisonLineChartByDay(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台名") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName){
//		groupName="常青组";
//		sourceName="PC网站";
//		roomName="消化系统";
//		staffName="罗健薇";
		return preSalesPharmacistService.queryPharmacistComparisonLineChartByDay(groupName,sourceName,roomName,staffName);
	}
	/**
	 * 
	 * @Description 药师页面上周本周周对比折线图
	 * @param groupName 科组名
	 * @param sourceName 平台名
	 * @param roomName 科室名
	 * @param staffName 员工名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月15日 上午10:28:29
	 */
	@ApiOperation(value="药师页面上周本周周对比折线图",notes="根据科组名，平台名，科室名，员工名来筛选")
	@ResponseBody
	@RequestMapping(value="pharmacist/queryComparisonLineChartByWeek")
	public Map<String,Object> queryPharmacistComparisonLineChartByWeek(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台名") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName){
//		groupName="常青组";
//		sourceName="PC网站";
//		roomName="消化系统";
//		staffName="罗健薇";
		return preSalesPharmacistService.queryPharmacistComparisonLineChartByWeek(groupName,sourceName,roomName,staffName);
	}
	/**
	 * @Description 药师页面近30天表格
	 * @param groupName 科组名
	 * @param sourceName 平台名
	 * @param roomName 科室名
	 * @param staffName 员工名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月15日 上午10:27:58
	 */
	@ApiOperation(value="药师页面近30天数据的表格",notes="根据科组名，平台名，科室名，员工名来筛选")
	@ResponseBody
	@RequestMapping(value="pharmacist/queryTableDataByDay")
	public Map<String,List<String[]>> queryPharmacistTableDataByDay(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台名") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName){
//		groupName="常青组";
//		sourceName="PC网站";
//		roomName="消化系统";
//		staffName="罗健薇";
		return preSalesPharmacistService.queryPharmacistTableDataByDay(groupName,sourceName,roomName,staffName);
	}
	/**
	 * @Description 药师页面近12个月数据的表格
	 * @param groupName 科组名
	 * @param sourceName 平台名
	 * @param roomName 科室名
	 * @param staffName 员工名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月15日 上午10:26:27
	 */
	@ApiOperation(value="药师页面近12个月数据的表格",notes="根据科组名，平台名，科室名，员工名来筛选")
	@ResponseBody
	@RequestMapping(value="pharmacist/queryTableDataByMonth")
	public Map<String,List<String[]>> queryPharmacistTableDataByMonth(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台名") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName){
//		groupName="常青组";
//		sourceName="PC网店";
//		roomName="消化系统";
//		staffName="罗健薇";
		return preSalesPharmacistService.queryPharmacistTableDataByMonth(groupName,sourceName,roomName,staffName);
	}
	/**
	 * 
	 * @Description 药师页面近两年表格
	 * @param groupName 科组名
	 * @param sourceName 平台名
	 * @param roomName 科室名
	 * @param staffName 员工名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月15日 上午10:26:27
	 */
	@ApiOperation(value="药师页面近两年数据的表格",notes="根据科组名，平台名，科室名，员工名来筛选")
	@ResponseBody
	@RequestMapping(value="pharmacist/queryTableDataByYear")
	public Map<String,List<String[]>> queryPharmacistTableDataByYear(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台名") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名(如:PC网店)") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName){
//		groupName="常青组";
//		sourceName="PC网店";
//		roomName="消化系统";
//		staffName="罗健薇";
		return preSalesPharmacistService.queryPharmacistTableDataByYear(groupName,sourceName,roomName,staffName);
	}
	
	/**
	 * @Description 查询重点产品销售排行
	 * @param groupName 科组名
	 * @param wareName 重点产品名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月21日 下午3:33:12
	 */
	@ApiOperation(value="查询重点产品任务完成率排行",notes="根据科组名来筛选")
	@ResponseBody
	@RequestMapping(value="keyproduct/queryKeyProductTaskRank")
	public List<Map<String,Object>> queryKeyProductTaskRank(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName){
//		groupName="常青组";
		return preSalesKeyProductService.queryKeyProductTaskRank(groupName);
	}
	@ApiOperation(value="查询重点产品客服销售排行",notes="根据科组名，重点产品名来筛选")
	@ResponseBody
	@RequestMapping(value="keyproduct/queryKeyProductStaffSalesRank")
	public List<Map<String,Object>> queryKeyProductStaffSalesRank(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="wareName", value ="重点产品名字") @RequestParam(value = "wareName",required = false)String wareName){
//		groupName="常青组";
//		wareName="谱乐益 匹多莫德颗粒 2g:0.4g*30袋";
		return preSalesKeyProductService.queryKeyProductStaffSalesRank(groupName,wareName);
	}
	/**
	 * @Description 查询重点产品销售指标数据的表格
	 * @param groupName 科组名
	 * @param sourceName 平台名
	 * @param staffName 员工名
	 * @param wareName 重点产品名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月21日 下午3:33:12
	 */
	@ApiOperation(value="查询重点产品销售指标数据的表格",notes="根据科组名，平台名，员工名，重点产品名来筛选")
	@ResponseBody
	@RequestMapping(value="keyproduct/queryStaffSalesTable")
	public List<Object[]> queryKeyProductStaffSalesTable(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台(如:PC网店)") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName,
			@ApiParam(required = true, name ="wareName", value ="重点产品名字") @RequestParam(value = "wareName",required = false)String wareName){
//		groupName="常青组";
//		sourceName="PC网站";
//		staffName="欧文莉";
//		wareName="健力多 氨糖软骨素钙片 1.02g*60片";
		return preSalesKeyProductService.queryKeyProductStaffSalesTable(groupName,sourceName,staffName,wareName);
	}
	/**
	 * @Description 查询重点产品各渠道数据的表格
	 * @param groupName 科组名
	 * @param sourceName 平台名
	 * @param staffName 员工名
	 * @param wareName 重点产品名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月21日 下午3:33:12
	 */
	@ApiOperation(value="查询重点产品各渠道数据的表格",notes="根据科组名，平台名，员工名，重点产品名来筛选")
	@ResponseBody
	@RequestMapping(value="keyproduct/queryStaffSalesTableByChannel")
	public List<Object[]> queryKeyProductStaffSalesTableByChannel(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台(如:PC网店)") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName,
			@ApiParam(required = true, name ="wareName", value ="重点产品名字") @RequestParam(value = "wareName",required = false)String wareName){
//		groupName="常青组";
//		sourceName="PC网站";
//		staffName="欧文莉";
//		wareName="健力多 氨糖软骨素钙片 1.02g*60片";
		return preSalesKeyProductService.queryKeyProductStaffSalesTableByChannel(groupName,sourceName,staffName,wareName);
	}
	/**
	 * @Description 查询重点产品本月上月数据对比的折线图
	 * @param groupName 科组名
	 * @param sourceName 平台名
	 * @param staffName 员工名
	 * @param wareName 重点产品名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月21日 下午3:33:12
	 */
	@ApiOperation(value="查询重点产品本月上月数据对比的折线图",notes="根据科组名，平台名，员工名，重点产品名来筛选")
	@ResponseBody
	@RequestMapping(value="keyproduct/queryComparisonLineChartByDayofMonth")
	public Map<String,Object> queryKeyProductComparisonLineChartByDayofMonth(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台(如:PC网店)") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName,
			@ApiParam(required = true, name ="wareName", value ="重点产品名字") @RequestParam(value = "wareName",required = false)String wareName){
//		groupName="常青组";
//		sourceName="PC网站";
//		staffName="欧文莉";
//		wareName="健力多 氨糖软骨素钙片 1.02g*60片";
		return preSalesKeyProductService.queryKeyProductComparisonLineChartByDayofMonth(groupName,sourceName,staffName,wareName);
	}
	/**
	 * 
	 * @Description 查询重点产品本周上周数据对比的折线图
	 * @param groupName 科组名
	 * @param sourceName 平台名
	 * @param staffName 员工名
	 * @param wareName 重点产品名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月21日 下午3:33:12
	 */
	@ApiOperation(value="查询重点产品本周上周数据对比的折线图",notes="根据科组名，平台名，员工名，重点产品名来筛选")
	@ResponseBody
	@RequestMapping(value="keyproduct/queryComparisonLineChartByWeek")
	public Map<String,Object> queryKeyProductComparisonLineChartByWeek(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台(如:PC网店)") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName,
			@ApiParam(required = true, name ="wareName", value ="重点产品名字") @RequestParam(value = "wareName",required = false)String wareName){
//		groupName="常青组";
//		sourceName="PC网站";
//		staffName="欧文莉";
//		wareName="健力多 氨糖软骨素钙片 1.02g*60片";
		return preSalesKeyProductService.queryKeyProductComparisonLineChartByWeek(groupName,sourceName,staffName,wareName);
	}
	/**
	 * 
	 * @Description 查询重点产品近12个月数据的表格
	 * @param groupName 科组名
	 * @param sourceName 平台名
	 * @param staffName 员工名
	 * @param wareName 重点产品名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月21日 下午3:33:12
	 */
	@ApiOperation(value="查询重点产品近12个月数据的表格",notes="根据科组名，平台名，员工名，重点产品名来筛选")
	@ResponseBody
	@RequestMapping(value="keyproduct/queryTableDataByMonth")
	public Map<String,List<String[]>> queryKeyProductTableDataByMonth(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台(如:PC网店)") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName,
			@ApiParam(required = true, name ="wareName", value ="重点产品名字") @RequestParam(value = "wareName",required = false)String wareName){
//		groupName="常青组";
//		sourceName="PC网站";
//		staffName="欧文莉";
//		wareName="健力多 氨糖软骨素钙片 1.02g*60片";
		return preSalesKeyProductService.queryKeyProductTableDataByMonth(groupName,sourceName,staffName,wareName);
	}
	/**
	 * 
	 * @Description 查询重点产品近两年数据的表格
	 * @param groupName 科组名
	 * @param sourceName 平台名
	 * @param staffName 员工名
	 * @param wareName 重点产品名
	 * @return
	 * @author yangjun
	 * @Date 2017年3月21日 下午3:33:12
	 */
	@ApiOperation(value="查询重点产品近两年数据的表格",notes="根据科组名，平台名，员工名，重点产品名来筛选")
	@ResponseBody
	@RequestMapping(value="keyproduct/queryTableDataByYear")
	public Map<String,List<String[]>> queryKeyProductTableDataByYear(
			@ApiParam(required = true, name ="groupName", value ="科组名(如:常青组)") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="sourceName", value ="平台(如:PC网店)") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName,
			@ApiParam(required = true, name ="wareName", value ="重点产品名字") @RequestParam(value = "wareName",required = false)String wareName){
//		groupName="常青组";
//		sourceName="PC网站";
//		staffName="欧文莉";
//		wareName="健力多 氨糖软骨素钙片 1.02g*60片";
		return preSalesKeyProductService.queryKeyProductTableDataByYear(groupName,sourceName,staffName,wareName);
	}
	
	
	/**
	 * @Description 获取单品的下拉列表
	 * @return
	 * @author yangjun
	 * @Date 2017年3月22日 下午4:00:13
	 */
	@ApiOperation(value="获取单品的下拉列表",notes="只用在单品页面")
	@ResponseBody
	@RequestMapping(value="singleProduct/querySingleProductList")
	public List<String> querySingleProductList(){
		return preSalesSingleProductService.querySingleProduct();
	}
	/**
	 * @Description 查询单品咨询转化页面的咨询量排行以及转化率排行
	 * @param channelName
	 * @param sourceName
	 * @param roomName
	 * @return
	 * @author yangjun
	 * @Date 2017年3月22日 下午4:00:22
	 */
	@ApiOperation(value="查询单品咨询转化页面的咨询量排行以及转化率排行",notes="根据渠道名，平台名，科室品名来筛选")
	@ResponseBody
	@RequestMapping(value="singleProduct/queryRank")
	public Map<String,Object> queryRank(
			@ApiParam(required = true, name ="channelName", value ="渠道名") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="sourceName", value ="平台(如:PC网店)") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名") @RequestParam(value = "roomName",required = false)String roomName){
//		channelName = "在线咨询";
//		sourceName = "PC网站";
//		roomName = "成人";
		return preSalesSingleProductService.queryRank(channelName, sourceName, roomName);
	}
	/**
	 * @Description 查询单品咨询转化页面的商品排行
	 * @param channelName
	 * @param sourceName
	 * @param roomName
	 * @param wareCode
	 * @param wareName
	 * @return
	 * @author yangjun
	 * @Date 2017年3月22日 下午4:00:34
	 */
	@ApiOperation(value="查询单品咨询转化页面的商品表格",notes="根据渠道名，平台名，科室品名，商品编码，商品名称来筛选")
	@ResponseBody
	@RequestMapping(value="singleProduct/queryWareTable")
	public List<Object[]> queryWareTable(
			@ApiParam(required = true, name ="channelName", value ="渠道名") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="sourceName", value ="平台(如:PC网店)") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="wareCode", value ="商品编号") @RequestParam(value = "wareCode",required = false)String wareCode,
			@ApiParam(required = true, name ="wareName", value ="商品名称") @RequestParam(value = "wareName",required = false)String wareName){
//		channelName = "在线咨询";
//		sourceName = "PC网站";
//		roomName = "成人";
//		wareCode="45267";
//		wareName="必利劲 盐酸达泊西汀片 30mg*6片";
		return preSalesSingleProductService.queryWareTable(channelName, sourceName, roomName,wareCode,wareName);
	}
	@ApiOperation(value="查询单品咨询转化页面的渠道表格",notes="根据渠道名，平台名，科室品名，商品编码，商品名称来筛选")
	@ResponseBody
	@RequestMapping(value="singleProduct/queryChannelTable")
	public List<Object[]> queryChannelTable(
			@ApiParam(required = true, name ="channelName", value ="渠道名") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="sourceName", value ="平台(如:PC网店)") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="wareCode", value ="商品编号") @RequestParam(value = "wareCode",required = false)String wareCode,
			@ApiParam(required = true, name ="wareName", value ="商品名称") @RequestParam(value = "wareName",required = false)String wareName){
//		channelName = "在线咨询";
//		sourceName = "PC网站";
//		roomName = "成人";
//		wareCode="45267";
//		wareName="必利劲 盐酸达泊西汀片 30mg*6片";
		return preSalesSingleProductService.queryChannelTable(channelName, sourceName, roomName,wareCode,wareName);
	}
	/**
	 * @Description 查询单品咨询转化页面本月上月数据对比的折线图
	 * @param channelName
	 * @param sourceName
	 * @param roomName
	 * @param wareCode
	 * @param wareName
	 * @return
	 * @author yangjun
	 * @Date 2017年3月22日 下午4:00:45
	 */
	@ApiOperation(value="查询单品咨询转化页面本月上月数据对比的折线图",notes="根据渠道名，平台名，科室名，商品编号，商品名称来筛选")
	@ResponseBody
	@RequestMapping(value="singleProduct/queryComparisonLineChartByDayofMonth")
	public Map<String,Object> queryKeyProductComparisonLineChartByDayofMonth(
			@ApiParam(required = true, name ="channelName", value ="渠道名") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="sourceName", value ="平台(如:PC网店)") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="wareCode", value ="商品编号") @RequestParam(value = "wareCode",required = false)String wareCode,
			@ApiParam(required = true, name ="wareName", value ="商品名称") @RequestParam(value = "wareName",required = false)String wareName){
//		channelName = "在线咨询";
//		sourceName = "PC网站";
//		roomName = "成人";
//		wareCode="45267";
//		wareName="必利劲 盐酸达泊西汀片 30mg*6片";
		return preSalesSingleProductService.querySingleProductComparisonLineChartByDayofMonth(channelName, sourceName, roomName,wareCode,wareName);
	}
	/**
	 * @Description 查询单品咨询转化页面本周上周数据对比的折线图
	 * @param channelName
	 * @param sourceName
	 * @param roomName
	 * @param wareCode
	 * @param wareName
	 * @return
	 * @author yangjun
	 * @Date 2017年3月22日 下午4:01:00
	 */
	@ApiOperation(value="查询单品咨询转化页面本周上周数据对比的折线图",notes="根据渠道名，平台名，科室名，商品编号，商品名称来筛选")
	@ResponseBody
	@RequestMapping(value="singleProduct/queryComparisonLineChartByWeek")
	public Map<String,Object> queryKeyProductComparisonLineChartByWeek(
			@ApiParam(required = true, name ="channelName", value ="渠道名") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="sourceName", value ="平台(如:PC网店)") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="wareCode", value ="商品编号") @RequestParam(value = "wareCode",required = false)String wareCode,
			@ApiParam(required = true, name ="wareName", value ="商品名称") @RequestParam(value = "wareName",required = false)String wareName){
//		channelName = "在线咨询";
//		sourceName = "PC网站";
//		roomName = "成人";
//		wareCode="45267";
//		wareName="必利劲 盐酸达泊西汀片 30mg*6片";
		return preSalesSingleProductService.querySingleProductComparisonLineChartByWeek(channelName, sourceName, roomName,wareCode,wareName);
	}
	/**
	 * @Description 查询单品咨询转化页面近12个月的数据表格
	 * @param channelName
	 * @param sourceName
	 * @param roomName
	 * @param wareCode
	 * @param wareName
	 * @return
	 * @author yangjun
	 * @Date 2017年3月22日 下午4:01:12
	 */
	@ApiOperation(value="查询单品咨询转化页面近12个月的数据表格",notes="根据渠道名，平台名，科室名，商品编号，商品名称来筛选")
	@ResponseBody
	@RequestMapping(value="singleProduct/queryTableDataByMonth")
	public Map<String,List<String[]>> querySingleProductTableDataByMonth(
			@ApiParam(required = true, name ="channelName", value ="渠道名") @RequestParam(value = "channelName",required = false)String channelName,
			@ApiParam(required = true, name ="sourceName", value ="平台(如:PC网店)") @RequestParam(value = "sourceName",required = false)String sourceName,
			@ApiParam(required = true, name ="roomName", value ="科室名") @RequestParam(value = "roomName",required = false)String roomName,
			@ApiParam(required = true, name ="wareCode", value ="商品编号") @RequestParam(value = "wareCode",required = false)String wareCode,
			@ApiParam(required = true, name ="wareName", value ="商品名称") @RequestParam(value = "wareName",required = false)String wareName){
//		channelName = "在线咨询";
//		sourceName = "PC网站";
//		roomName = "成人";
//		wareCode="45267";
//		wareName="必利劲 盐酸达泊西汀片 30mg*6片";
		return preSalesSingleProductService.queryKeyProductTableDataByMonth(channelName, sourceName, roomName,wareCode,wareName);
	}
	
	@ApiOperation(value="查询推荐商品的排行",notes="根据科组名来筛选")
	@ResponseBody
	@RequestMapping(value="recommend/queryRank")
	public Map<String,Object> queryRank(
			@ApiParam(required = true, name ="groupName", value ="科组名") @RequestParam(value = "groupName",required = false)String groupName){
//		groupName = "男科组";
		return preSalesRecommendProductService.queryRank(groupName);
	}
	@ApiOperation(value="查询推荐关键词的员工表格",notes="根据科组名，推荐关键词来筛选")
	@ResponseBody
	@RequestMapping(value="recommend/queryRecommendKeywordTable")
	public List<Object[]> queryRank(
			@ApiParam(required = true, name ="groupName", value ="科组名") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="adviceKeyword", value ="员工名") @RequestParam(value = "adviceKeyword",required = false)String adviceKeyword){
//		groupName = "常青组";
//		adviceKeyword="龟鹿补肾片";
		return preSalesRecommendProductService.queryRecommendKeywordTable(groupName,adviceKeyword);
	}
	@ApiOperation(value="查询员工的推荐关键词表格",notes="根据科组名，员工名来筛选")
	@ResponseBody
	@RequestMapping(value="recommend/queryRecommendStaffTable")
	public List<Object[]> queryRecommendStaffTable(
			@ApiParam(required = true, name ="groupName", value ="科组名") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName){
//		groupName = "常青组";
//		staffName = "卢芳";
		return preSalesRecommendProductService.queryRecommendStaffTable(groupName,staffName);
	}
	
	
	@ApiOperation(value="查询推荐关键词表格",notes="根据科组名，员工名来筛选")
	@ResponseBody
	@RequestMapping(value="recommend/queryAdviceKeywordTable")
	public Map<String,Map<String,List<String[]>>> queryAdviceKeywordTableData(
			@ApiParam(required = true, name ="groupName", value ="科组名") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="staffName", value ="员工名") @RequestParam(value = "staffName",required = false)String staffName){
//		groupName = "常青组";
//		staffName = "卢芳";
		return preSalesRecommendProductService.queryAdviceKeywordTableData(groupName,staffName);
	}
	
	@ApiOperation(value="查询推荐关键词表格",notes="根据科组名，关键词来筛选")
	@ResponseBody
	@RequestMapping(value="recommend/queryStaffTableData")
	public Map<String,Map<String,List<String[]>>> queryStaffTableData(
			@ApiParam(required = true, name ="groupName", value ="科组名") @RequestParam(value = "groupName",required = false)String groupName,
			@ApiParam(required = true, name ="adviceKeyword", value ="关键词") @RequestParam(value = "adviceKeyword",required = false)String adviceKeyword){
//		groupName = "常青组";
//		adviceKeyword = "健力多";
		return preSalesRecommendProductService.queryStaffTableData(groupName,adviceKeyword);
	}
}
